package com.example.demo2.mapper;
import com.example.demo2.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface Usermapper {
    @Insert("insert into userInfo(openID,nickName,gender,province,city,avatarUrl) values (#{openID},#{nickName},#{gender},#{province},#{city},#{avatarUrl})")
    void saveTnStudent(User user);

    @Select("select * from userInfo ")
    @Results(id="UserMap", value={
            @Result(column = "openID",property = "openID"),
            @Result(column = "nickName",property = "nickName"),
            @Result(column = "gender",property = "gender"),
            @Result(column = "province",property = "province"),
            @Result(column = "city",property = "city"),
            @Result(column = "avatarUrl",property = "avatarUrl")


    })
    List<User> getallUser();
    @Select("select * from userInfo where openID = #{openID}")
    User getUser(String openID);
    @Update("update userInfo set nickName = #{nickName},gender = #{gender},province = #{province},city = #{city},avatarUrl= #{avatarUrl} where openID=#{openID}")
    void updateUser(User user);

}